package xiaohu.day6.HJ66;



import java.util.*;

public class Main {
    public static HashMap<String, String> map = new HashMap<String, String>(){
        {
            put("reset", "reset what");
            put("reset board", "board fault");
            put("board add", "where to add");
            put("board delete", "no board at all");
            put("reboot backplane", "impossible");
            put("backplane abort", "install first");
        }
    };

    public static HashMap<String, String> map1 = new HashMap<String, String>(){
        {
//            put("reset", "reset what");
            put( "board"      ,"reset"    );
            put( "add"        ,"board"    );
            put( "delete"     ,"board"    );
            put( "backplane"  ,"reboot"   );
            put( "abort"      ,"backplane");
        }
    };

/*    public static Collection<String> keys=new ArrayList<>(){
        {
            add("reset");
            add("reset board");
            add("board add");
            add("board delete");
            add("reboot backplane");
            add("backplane abort");
        }
    };*/

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
                String[] split = scanner.nextLine().split(" ");
                if (split.length == 1) {
                    handleSingle(split[0]);
                }else if (split.length == 2) {
                    handleDouble(split[0], split[1]);
                }
        }
    }

    private static void handleDouble(String s, String s1) {
        int count = 0;
        StringBuffer stringBuffer = new StringBuffer();
        for (Map.Entry<String, String> entry : map1.entrySet()) {
            if (entry.getKey().startsWith(s1) && entry.getValue().startsWith(s)) {
                count++;
                stringBuffer.append( entry.getValue()+ " " + entry.getKey());
            }
        }
        if (count == 1) {
            String strOut = map.get(stringBuffer+"");
            System.out.println(strOut);
        } else {
            System.out.println("unknown command");
        }
    }

    private static void handleSingle(String s) {
        if ("reset".contains(s)) {
            System.out.println(map.get("reset"));
        } else {
            System.out.println("unknown command");
        }
    }
}
